import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 用户信息信息 */
export interface BizUser {
          id: number; // 用户ID
          mobile?: string; // 手机号
          password: string; // 密码
          avatar?: string; // 头像
          nickname?: string; // 昵称
          remark: string; // 备注
  }

// 用户信息 API
export const BizUserApi = {
  // 查询用户信息分页
  getBizUserPage: async (params: any) => {
    return await request.get({ url: `/business/biz-user/page`, params })
  },

  // 查询用户信息详情
  getBizUser: async (id: number) => {
    return await request.get({ url: `/business/biz-user/get?id=` + id })
  },

  // 新增用户信息
  createBizUser: async (data: BizUser) => {
    return await request.post({ url: `/business/biz-user/create`, data })
  },

  // 修改用户信息
  updateStatus: async (id: number, status: boolean) => {
    return await request.put({ url: `/business/biz-user/change/` + id + `/` + status  })
  },

  // 修改用户信息
  updateBizUser: async (data: BizUser) => {
    return await request.put({ url: `/business/biz-user/update`, data })
  },

  // 删除用户信息
  deleteBizUser: async (id: number) => {
    return await request.delete({ url: `/business/biz-user/delete?id=` + id })
  },

  /** 批量删除用户信息 */
  deleteBizUserList: async (ids: number[]) => {
    return await request.delete({ url: `/business/biz-user/delete-list?ids=${ids.join(',')}` })
  },

  // 导出用户信息 Excel
  exportBizUser: async (params) => {
    return await request.download({ url: `/business/biz-user/export-excel`, params })
  },
}
